uniform bool uIsSelect;
uniform int uTextureNum;
uniform sampler2D uTexture0;
uniform vec2 uCoord;
varying vec4 vVertex;
varying vec3 vNormal;
varying vec3 vLightPos;

varying vec4 vColor;
void main()
{
	vec4 color = vColor;
	if(uTextureNum > 0)
	{
		vec2 coord = gl_TexCoord[0].st*uCoord;
		color *= texture2D(uTexture0, coord);
	}
	float diffuse = clamp(dot(normalize(vNormal), normalize(vLightPos - vVertex.xyz)), 0.0, 1.0);
	color.rgb *= diffuse;
	if(uIsSelect)
	{
		color.rgb *= vec3(1.0, 1.0, 0.0);
	}
	gl_FragColor = color;
}